package com.yxwl.demo.utils;

import android.annotation.SuppressLint;
import android.content.Context;
public class Utils {


    @SuppressLint("StaticFieldLeak")
    private static Context context;


    private Utils() {
        throw new UnsupportedOperationException("Utils 不能直接初始化");
    }

    public static void init(Context mContext) {
        if (Utils.context==null){
            Utils.context = mContext.getApplicationContext();
        }
    }

    public static Context getContext() {
        if (context != null)
            return context;
        throw new NullPointerException("Context 未初始化");
    }

}